package work.sajor.wechatpush.util;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.extra.mail.MailUtil;

import java.util.Date;

/**
 * @Description:
 * @author: Peng Wei
 * @date:2022/12/8 16:57
 */
public class Test {
    public static void main(String[] args) {

    }




    /**
     * 考研定时邮箱
     */
    private static void testMailXM() {
        //考研时间:
        String dateStr1 = "2022-12-24 00:00:00";
        Date date1 = DateUtil.parse(dateStr1);
        //相差一个月，31天
        long betweenDay = DateUtil.between(date1, new Date(), DateUnit.DAY);
        System.out.println(betweenDay);
        String nowTime = DateUtil.format(new Date(), "yyyy/MM/dd");

        MailUtil.send("2889214077@qq.com", nowTime,
                "<div style=\"border: 1px solid #ccc;width: 200px;background-color: rgb(54, 153, 224);color: azure;padding: 20px;\">\n" +
                        "        <b>大宝卫鹏过来提醒你啦！</b>\n" +
                        "        <div>\n" +
                        "            <b>距离考研还剩：</b>\n" + "<b style='color:#D82A20'>" + betweenDay + "天</b>" +
                        "        </div>\n" +
                        "        <div style=\"margin-top: 10px;\">一定要加油喔！！！</div>\n" +
                        "    </div>",
                true);
    }
}
